package com.scs.application.modules.svn.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.scs.application.core.entity.BaseEntity;
import com.scs.application.modules.upgrade.db.annotation.EntityClassAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityFieldAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityIndexAnnotation;
import com.scs.application.modules.upgrade.db.enums.EntityFieldType;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

@Data
@Accessors(chain = true)
@EntityClassAnnotation(remark = "svn版本记录表")
@TableName("svn_version")
@EntityIndexAnnotation(ix = {"version_num"})
public class SvnVersion extends BaseEntity {

    //主键
    @EntityFieldAnnotation(
            type = EntityFieldType.LONG
    )
    @TableId(type = IdType.ID_WORKER_STR)
    public String id;

    @EntityFieldAnnotation(
            text = "版本库",
            length = "30",
            not_null = true,
            default_value = "",
            comment = "版本库，dev/sit/release"
    )
    private String versionLib;

    @EntityFieldAnnotation(
            text = "版本库地址",
            length = "200",
            not_null = true,
            default_value = "",
            comment = "版本库地址"
    )
    private String versionUrl;


    @EntityFieldAnnotation(
            text = "版本号",
            length = "30",
            not_null = true,
            default_value = "",
            comment = "版本号"
    )
    private String versionNum;

    @EntityFieldAnnotation(
            text = "提交人",
            not_null = true,
            default_value = "",
            comment = "提交人"
    )
    private String submitUser;

    @EntityFieldAnnotation(
            text = "提交日期",
            not_null = true,
            default_value = "",
            comment = "提交日期"
    )
    private Date submitDate;

    @EntityFieldAnnotation(
            text = "影响文件列表",
            not_null = false,
            type = EntityFieldType.TEXT,
            default_value = "",
            comment = "影响文件列表"
    )
    private String fileList;

    @EntityFieldAnnotation(
            text = "影响文件数量",
            not_null = false,
            default_value = "",
            comment = "影响文件数量"
    )
    private int fileNum;


    @EntityFieldAnnotation(
            text = "提交原始日志",
            type = EntityFieldType.LONGTEXT,
            not_null = false,
            default_value = "",
            comment = "提交原始日志"
    )
    private String submitRemark;

    @EntityFieldAnnotation(
            text = "日志格式有效",
            not_null = true,
            default_value = "0",
            comment = "1：有效，0：无效，从submitRemark解析成功则为有效"
    )
    private Boolean changeValid;


    /*以下字段从submitRemark解析*/

    @EntityFieldAnnotation(
            text = "子系统类型",
            length = "30",
            not_null = false,
            default_value = "",
            comment = "spd前端，spd后端，智能柜前端，智能柜后端，spdpda"
    )
    private String changeSystem;

    @EntityFieldAnnotation(
            text = "影响菜单",
            length = "1000",
            not_null = false,
            default_value = "",
            comment = "菜单如果有的话，从submitRemark解析"
    )
    private String changeMenu;

    @EntityFieldAnnotation(
            text = "功能分类",
            length = "50",
            not_null = false,
            default_value = "",
            comment = "基建|主数据|外设|业务|配送|财务|BI|无 【多个,分割】，从submitRemark解析"
    )
    private String changeType;


    @EntityFieldAnnotation(
            text = "需求来源",
            length = "50",
            not_null = false,
            default_value = "",
            comment = "TAPD缺陷|TAPD需求|禅道任务|禅道bug|无 ，从submitRemark解析"
    )
    private String changeFrom;

    @EntityFieldAnnotation(
            text = "需求来源标识",
            length = "50",
            not_null = false,
            default_value = "",
            comment = "任务id，bugid等，从submitRemark解析"
    )
    private String changeCode;

    @EntityFieldAnnotation(
            text = "需求来源链接",
            type = EntityFieldType.LONGTEXT,
            not_null = false,
            comment = "需求来源链接|无 【多个,分割】，从submitRemark解析"
    )
    private String changeUrl;

    @EntityFieldAnnotation(
            text = "修改描述",
            type = EntityFieldType.LONGTEXT,
            not_null = false,
            comment = "修改描述，从submitRemark解析"
    )
    private String changeRemark;

    @EntityFieldAnnotation(
            text = "重要程度",
            not_null = false,
            comment = "一般，重要(基建相关修改、其他功能分类的BUG)|无 ，从submitRemark解析成功则为有效"
    )
    private String changeImportance;


    @EntityFieldAnnotation(
            text = "已合并",
            not_null = false,
            default_value = "",
            comment = "比如：dev是否合并到sit，只要原始日志包含被合并的版本就可以"
    )
    private boolean flagMerge;

    //已合并的版本：
    @EntityFieldAnnotation(
            text = "合并目标版本",
            length = "500",
            not_null = false,
            default_value = "",
            comment = "比如：dev合并到sit，这里为sit对应的版本，只要原始日志包含被合并的版本就可以"
    )
    private String mergeVersions;

    @EntityFieldAnnotation(
            text = "日志是否包含版本",
            not_null = false,
            default_value = "",
            comment = "合并版本，包含为:true"
    )
    private boolean flagHaveVersion;

}
